<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <style type="text/css">
    	body{
    		 background:url(img/bg.png);
    		 padding-bottom: 52px;
    	}
    	.mui-content.con{
				padding-left: 20px;
				padding-right: 20px;
				position: relative;
			}
			.scan{
				width: 15%;
			}
			.pos{
				/*position: fixed;*/
				/*left: 50%;
				top: 50%;
				transform: translate(-50%,-50%);*/
				/*display: flex;
				justify-content: center;
				flex-direction: column;
				align-content: center;*/
				text-align: center;
			}
			.pos img{
				width: 200px;
				height: 200px;
				margin: 0px auto 0;
			}
			.pos p{
				margin-top: 10px;
				order: 2;
				font-size: 16px;
			}
			.banquan{
				margin-top: 10px;
				width:100%;
				text-align: center;
				font-size: 14px;
			}
    </style>
    <script src="" type="text/javascript" charset="utf-8"></script>
    <script src="js/publicErr.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<header class="mui-bar mui-bar-nav" style="background-color: #01AEDB;">
		<h1 style="color: #fff;" class="mui-title">首页</h1>
	</header>
		<div class="mui-content con" style="text-align: center">
			<img src="./img/logo.png" style="text-align: ; width: 60%;margin-top:20%;margin-bottom: 50px;" alt="" />
			<div id="qrcode" class="pos">
				<p id="ststus" style="color: red;"></p>
			</div>
			<div id="" style="margin-top: 30px;margin-bottom: 20px;"  onclick="clicked('barcode_scan2.html',true,true)">
				<img id="scan" class="scan" src="img/scan.png"/>
				<p>点击消票</p>
			</div>
		</div>
		<p class="banquan">版权所有©上海永乐数码科技公司<br/>沪ICP备10202509号-2</p>
</body>
<script src="js/mui.min.js"></script>
<script src="js/urlfun.js" type="text/javascript" charset="utf-8"></script>
<script src="js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="js/qrcode.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/request.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
			var random = parseInt(Math.random()*10000).toString()
			new QRCode(document.getElementById("qrcode"), "http://api.paradise4d.com/reeserver/index.do?random_code=" + random);
			console.log(random);
			(function($, doc) {
				$.init({
//					statusBarBackground: '#f7f7f7'
				});
				$.plusReady(function() {
					did = plus.device.uuid.toString();
					document.addEventListener("netchange", onNetChange, false);  
				})
				var allTime = 0
				
				//设置事件监听
				function pushAuth() {
					++allTime;
					var timer;
					console.log(random);
					var data = {
						random_code:random,
					}
					request.requestAjax("post","game/get",data,function(res){
						console.log(JSON.stringify(res))
						if(res.state == true){
							localStorage.setItem("info",JSON.stringify(res));
							mui.openWindow({
								url: "information.html",
								id: "information.html",
								createNew:true,
							})
						}
						if(res.code){
							pushAuth();
						}
					},function(res){
						pushAuth();
						console.log(JSON.stringify(res))
						console.log("网络错误")
					})
				}
				pushAuth();
			var backButtonPress = 0;
			mui.oldback = mui.back;
			mui.back = function(event) {
						backButtonPress++;
						if (backButtonPress > 1) {
							plus.runtime.quit();
						} else {
							plus.nativeUI.toast('再按一次退出应用');
						}
						setTimeout(function() {
							backButtonPress = 0;
						}, 1000);
					
					return false;
				};
				
			}(mui, document));
			function onAgain() {
				mui.openWindow({
					url: "information.html",
					id: "information.html",
					createNew:true,
				})
			}
			
			function onNetChange(){
				var pstetus = document.getElementById("ststus");
				var nt = plus.networkinfo.getCurrentType();
				switch (nt){
					case plus.networkinfo.CONNECTION_ETHERNET:
					case plus.networkinfo.CONNECTION_WIFI:
					plus.nativeUI.toast('您已在wifi网络状态下！'); 
					pstetus.innerText = "";
					break; 
					case plus.networkinfo.CONNECTION_CELL2G:
					plus.nativeUI.toast('当前网络为2G网络，可能存在信号不好问题！'); 
					pstetus.innerText = "";
					case plus.networkinfo.CONNECTION_CELL3G:
					plus.nativeUI.toast('当前网络为3G网络，可能存在信号不好问题！'); 
					pstetus.innerText = "";
					case plus.networkinfo.CONNECTION_CELL4G:
					plus.nativeUI.toast('您已在4G网络状态下！'); 
					pstetus.innerText = "";
					break; 
					default:
					pstetus.innerText = "无网络，请重新连接！";
					plus.nativeUI.toast('当前无网络连接或信号不好，请连接重新连接网络！'); 
					break;
				}
			}
			
			var scan = document.getElementById("scan");
			scan.addEventListener("click",function(){
			},false)
			function checkScan(){
				
			}
</script>
</html>